<!--
 * @Author: your name
 * @Date: 2021-07-20 14:21:01
 * @LastEditTime: 2021-10-21 17:07:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \usp-osm-frondend\src\views\orderCenter\refundOrder\details.vue
-->
<template>
  <div
    class="white-content"
    v-loading="pageLoading"
    element-loading-text="加载中"
  >
    <div class="newPageTitle">
      <span class="backIcon" @click="goBack"><i class="el-icon-back"></i></span>
      <h1 style="display: inline-block; margin-left: 10px; font-weight: bold">
        退款单详情
      </h1>
    </div>
    <div class="detail-content-section">
      <h2>
        <span>退款单信息</span>
        <span style="float: right">
          退款单状态：
          {{ getDictionaryNameByCode('REFUNDMAINSTATUS', refundInfo.refundStatus) }}
        </span>
      </h2>
      <el-form
        label-width="auto"
        style="border-bottom: 1px solid #ebeef5"
      >
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="退款单号:">
              {{ refundInfo.refundNo }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="关联主订单号:">
              <span
                @click="masterDetails(refundInfo.orderId)"
                class="colorLink"
              >
                {{ refundInfo.orderNo }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="关联子订单号:">
              <span
                @click="subDetails(refundInfo.subOrderId)"
                class="colorLink"
              >
                {{ refundInfo.subOrderNo }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="showReturnOrder">
            <el-form-item label="关联退货单号:">
              <span
                @click="returnDetails(refundInfo.returnOrderId)"
                class="colorLink"
              >
                {{ refundInfo.returnOrderNo }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="关联子订单类型:">
              {{
                getDictionaryNameByCode('SUBORDERTYPE', refundInfo.subOrderType)
              }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户ID:">
              {{ refundInfo.customerId }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户姓名:">
              {{ refundInfo.customerName }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="VIN:">{{ refundInfo.vin }}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户手机号:">
              {{ refundInfo.customerMobile }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户邮箱:">
              {{ refundInfo.customerEmial }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="退款单创建时间：">{{ refundInfo.createTime | timestampToChange('time') }}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="退款单更新时间：">{{ refundInfo.updateTime | timestampToChange('time') }}</el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="detail-section">
        <div style="margin: 10px 0">
          <el-button
            @click="agreeRefund"
            :disabled="isAgree"
            class="dark-btn"
            v-show="showBtn"
            style="margin-bottom: 0 !important"
            v-if="$auth('orderManagement:refundNote:agreeToReturn')"
            >同意退款申请</el-button
          >
          <el-button
            @click="refusedRefund"
            :disabled="isAgree"
            class="dark-btn"
            v-show="showBtn"
            style="margin-bottom: 0 !important"
            v-if="$auth('orderManagement:refundNote:rejectOfReturn')"
            >拒绝退款申请</el-button
          >
          <el-button
            class="dark-btn"
            v-show="showBtn"
            @click="toViewer"
            >查看退货图片
          </el-button>
          <el-button
          class="dark-btn"
          @click="toRemark"
          v-if="$auth('orderManagement:returnNote:reviewRemark')"
          >查看备注
        </el-button>
        </div>
        <el-table :data="tableData">
          <!-- <el-table-column
            type="selection"
            width="50"
            align="center"
            size="mini"
            label-class-name="table-selection"
          >
          </el-table-column> -->
          <el-table-column
            label="商品名称"
            prop="spuName"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <!-- <el-table-column
            label="退款商品状态"
            prop="refundStatus"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span>{{
                getDictionaryNameByCode('REFUNDSTATUS', scope.row.refundStatus)
              }}</span>
            </template>
          </el-table-column> -->
          <el-table-column
            label="SKU Code"
            prop="skuCode"
            align="center"
            min-width="120"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            label="SPU Code"
            prop="spuCode"
            align="center"
            min-width="120"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            label="退款商品数量"
            prop="quantity"
            align="center"
            min-width="120"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <!-- <el-table-column
            label="申请时间"
            prop="createTime"
            align="center"
            min-width="160"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">{{
              scope.row.createTime | timestampToChange('time')
            }}</template>
          </el-table-column>
          <el-table-column
            label="更新时间"
            align="center"
            min-width="160"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">{{
              scope.row.updateTime | timestampToChange('time')
            }}</template>
          </el-table-column> -->
          <el-table-column
            label="申请退款金额"
            prop="applyRefundAmount"
            align="center"
            min-width="120"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              {{ getPoint(scope.row.applyRefundAmount) }}
            </template>
          </el-table-column>
          <el-table-column
            label="实际退款金额"
            prop="actualRefundAmount"
            align="center"
            min-width="120"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              {{ getPoint(scope.row.actualRefundAmount) }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <div class="detail-content-section">
      <h2 style="margin: 20px 0 10px">退款详情</h2>
      <el-form
        :model="refundDetail"
        label-width="100px"
        label-position="left"
        style="border-top: 1px solid #ebeef5"
      >
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="退款订单号:">
              {{ refundInfo.refundPaymentNo }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="退款平台:">
              {{ refundInfo.refundPlatform }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="退款状态:">
              {{ refundInfo.refundDetailStatus }}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="创建时间:">
              {{ refundInfo.refundDetailStartDate }}
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="完成时间:">
              {{ refundInfo.refundDetailCompleteDate }}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <el-dialog
      :visible.sync="agreeServeDialog"
      title="产品详情"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :wrapperClosable="false"
      :element-loading-text="'加载中'"
      :before-close="agreeServeClose"
      width="65%"
      append-to-body
      top="10px"
    >
      <el-table :data="productDetails">
        <el-table-column
          label="服务包名称"
          prop="servicePackageRightName"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="内容名称"
          prop="name"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="内容编号"
          prop="code"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="权益数量"
          prop="quantity"
          align="center"
          min-width="80"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="已使用数量"
          prop="usedQuantity"
          align="center"
          min-width="80"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="有效期起"
          prop="periodBeginTime"
          align="center"
          min-width="140"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="有效期止"
          prop="periodEndTime"
          align="center"
          min-width="140"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
      </el-table>
      <el-table :data="operationAmount" ref="operationAmount">
        <el-table-column
          label="申请退款金额"
          prop="applyRefundAmount"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            {{ getPoint(scope.row.applyRefundAmount) }}
          </template>
        </el-table-column>
        <el-table-column label="实际退款金额" align="center" min-width="100" ref="actualRefundAmountDialog">
          <template slot-scope="scope">
            <el-input
              placeholder="实际退款金额"
              type="number"
              v-model="scope.row.actualRefundAmountDialog"
              @input="actualRefundAmountChange(scope.row)"
              @blur="actualRefundAmountBlur(scope.row)"
              size="mini"
            ></el-input>
          </template>
        </el-table-column>
        <el-table-column label="备注" align="center" min-width="300" ref="remark">
          <template slot-scope="scope">
            <el-input
              placeholder="请输入备注内容(必填)"
              v-model="scope.row.remark"
              size="mini"
            ></el-input>
          </template>
        </el-table-column>
      </el-table>
      <div class="dialog-footer">
        <el-button class="search-btn" @click="onSubmit">确 定</el-button>
        <el-button @click="agreeServeClose" style="margin-left: 20px"
          >取 消</el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="refusedRefundDialog"
      title="备注（必填）"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :wrapperClosable="false"
      :before-close="refusedRefundClose"
      :element-loading-text="'加载中'"
      width="45%"
      append-to-body
      top="10px"
    >
      <div v-loading="pageLoading" :element-loading-text="'加载中'">
        <el-form
          :model="rejectForm"
          ref="rejectForm"
          :rules="rules"
          class="demo-ruleForm"
        >
          <el-form-item prop="rejectRemark">
            <el-input
              type="textarea"
              v-model="rejectForm.rejectRemark"
            ></el-input>
          </el-form-item>
        </el-form>
      <div class="dialog-footer">
        <el-button class="search-btn" @click="onSubmit">确 定</el-button>
        <el-button
          @click="refusedRefundClose"
          style="margin-left: 20px"
          >取 消</el-button
        >
      </div>
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="seeNoteDialog"
      title="查看备注"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :wrapperClosable="false"
      :element-loading-text="'加载中'"
      width="65%"
      append-to-body
      top="10px"
    >
      <el-table :data="checkRemarkData" v-loading="pageLoading" :element-loading-text="'加载中'">
        <el-table-column
          label="操作人"
          prop="operationName"
          align="center"
          min-width="80"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          label="操作时间"
          align="center"
          min-width="160"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            {{ scope.row.createTime | timestampToChange('time') }}
          </template>
        </el-table-column>
        <el-table-column
          label="审核类型"
          prop="type"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <span>{{
              getDictionaryNameByCode('AUDITTYPE', scope.row.type)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="审核结果"
          align="center"
          min-width="80"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <span>{{
              getDictionaryNameByCode('RESULTAUDIT', scope.row.statue)
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="备注信息"
          prop="remark"
          align="center"
          min-width="80"
          :show-overflow-tooltip="true"
        ></el-table-column>
      </el-table>
      <div class="dialog-footer" style="float: right">
        <el-button @click="seeNoteDialog = false">关 闭</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="agreeAccessoryDialog"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :destroy-on-close="true"
      :wrapperClosable="false"
      :element-loading-text="'加载中'"
      :before-close="handleClose"
      width="65%"
      append-to-body
      top="10px"
    >
      <div v-loading="pageLoading" :element-loading-text="'加载中'">
      <el-table :data="operationAmount" ref="operationAmount">
        <el-table-column
          label="商品名称"
          prop="spuName"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="数量"
          prop="quantity"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="金额"
          prop="applyRefundAmount"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            {{ getPoint(scope.row.applyRefundAmount) }}
          </template>
        </el-table-column>
        <el-table-column
          label="申请退款金额"
          prop="applyRefundAmount"
          align="center"
          min-width="100"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            {{ getPoint(scope.row.applyRefundAmount) }}
          </template>
        </el-table-column>
        <el-table-column
          label="实际退款金额"
          prop="actualRefundAmount"
          align="center"
          ref="actualRefundAmount"
          min-width="100"
        >
          <template slot-scope="scope">
            <el-input
              type="number"
              placeholder="实际退款金额"
              v-model="scope.row.actualRefundAmountDialog"
              @input="actualRefundAmountChange(scope.row)"
              @blur="actualRefundAmountBlur(scope.row)"
              size="mini"
            ></el-input>
          </template>
        </el-table-column>
      </el-table>
      <el-form ref="deliveryForm" :model="deliveryForm" label-position="top" :rules="rule" label-width="100px">
          <el-form-item label="备注" prop="remark">
            <el-input
              placeholder="可输入备注(必填)"
              type="textarea"
              v-model="deliveryForm.remark"
            ></el-input>
          </el-form-item>
        </el-form>
      <div class="dialog-footer">
        <el-button class="search-btn" @click="onSubmit">确 定</el-button>
        <el-button
          @click="agreeAccessoryDialog = false"
          style="margin-left: 20px"
          >取 消</el-button
        >
      </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Vue from 'vue'
import {
  refundDetails,
  approvalRefund,
  checkRemark,
  agreeToRefundDetail
} from '@/api/product'
import { USERNAME, USERID } from '@/config/variableInit'
import { common } from '@/mixins/common'
import { mapGetters } from 'vuex'
import { setRouterParams, getRouterParams } from '@/utils/auth'
export default {
  name: 'masterOrderDetails',
  components: {},
  mixins: [common],
  computed: {
    ...mapGetters(['lookupItems'])
  },
  data () {
    return {
      id: {},
      refundInfo: {},
      refundDetail: {},
      deliveryForm: {
        remark: ''
      },
      tableData: [],
      productDetails: [],
      checkRemarkData: [],
      operationAmount: [],
      rule: {
        remark: [{ required: true, message: '备注不能为空', trigger: 'blur' }]
      },
      rules: {
        rejectRemark: [
          { required: true, message: '请填写备注', trigger: 'blur' }
        ]
      },
      pageLoading: false,
      isAgree: true,
      showBtn: true,
      isRefuse: true,
      agreeServeDialog: false,
      agreeAccessoryDialog: false,
      refusedRefundDialog: false,
      showReturnOrder: false,
      seeNoteDialog: false,
      userName: '',
      userId: '',
      checkStatus: '',
      remarkInfo: false,
      actualRefundAmountInfo: false,
      rejectForm: {},
      selectionList: [],
      selectIdList: [],
      itemVoList: [],
      auditRecordVoList: {}
    }
  },
  mounted () {
    this.id = this.$route.params.id
    this.userName = Vue.ls.get(USERNAME)
    this.userId = Vue.ls.get(USERID)
    if (this.id) {
      if (this.id.subOrderType === '2') {
        this.showReturnOrder = true
      } else {
        this.showReturnOrder = false
      }
      if (this.id.subOrderType === '3') {
        this.showBtn = false
      } else {
        this.showBtn = true
      }
      setRouterParams(this.$route)
      this.fetchList()
    } else {
      const routeParams = getRouterParams(this.$route)
      this.id = routeParams.id
      this.fetchList()
    }
    if (this.id.subOrderType === '2') {
      this.showReturnOrder = true
    } else {
      this.showReturnOrder = false
    }
  },
  methods: {
    agreeServeClose () {
      this.operationAmount.forEach(e => {
        e.actualRefundAmountDialog = ''
        e.remark = ''
      })
      this.agreeServeDialog = false
    },
    refusedRefundClose () {
      this.$refs.rejectForm.resetFields()
      this.refusedRefundDialog = false
    },
    handleClose () {
      this.deliveryForm.remark = ''
      this.agreeAccessoryDialog = false
    },
    // 获取列表数据
    fetchList () {
      this.pageLoading = true
      const params = {
        id: this.id.id
      }
      refundDetails(params).then((res) => {
        this.pageLoading = false
        if (res) {
          if (Number(res.code) === 1) {
            const obj = res.obj
            this.refundInfo = obj || {}
            this.tableData = obj.list
            switch (this.refundInfo.refundDetailStatus) {
              case '1': this.refundInfo.refundDetailStatus = '退款中'; break
              case '2': this.refundInfo.refundDetailStatus = '退款完成'; break
              default: this.refundInfo.refundDetailStatus = ''; break
            }
            if (this.refundInfo.refundStatus === '1') {
              this.isAgree = false
            } else {
              this.isAgree = true
            }
          } else {
            this.$confirm(res.code, {
              confirmButtonText: '确定',
              showCancelButton: false
            })
          }
        }
      })
    },
    goBack () {
      this.$router.push({ name: 'refundOrder' })
    },
    masterDetails (id) {
      this.$router.push({ name: 'masterOrderDetails', params: { id: id } })
    },
    returnDetails (id) {
      this.$router.push({ name: 'returnOrderDetails', params: { id: id } })
    },
    subDetails (id) {
      this.$router.push({ name: 'suborderDetails', params: { id: id } })
    },
    toViewer () {
      this.$router.push({ name: 'previewImgs', params: { id: this.id.id, type: '2', returnOrderId: this.id.returnOrderId } })
    },

    toRemark (row) {
      this.seeNoteDialog = true
      this.checkRemark(this.id.id)
    },

    checkRemark (row) {
      this.pageLoading = true
      const params = {
        id: row,
        owerType: '2'
      }
      checkRemark(params).then((res) => {
        this.pageLoading = false
        if (res) {
          if (Number(res.code) === 1) {
            const obj = res.obj
            this.checkRemarkData = obj.list
          } else {
            this.$confirm(res.code, {
              confirmButtonText: '确定',
              showCancelButton: false
            })
          }
        }
      })
    },

    agreeRefund () {
      this.operationAmount = this.tableData
      if (this.refundInfo.subOrderType === '1') {
        this.pageLoading = true
        this.agreeServeDialog = true
        const params = {
          id: this.id.id,
          refundDetailList: this.selectIdList
        }
        agreeToRefundDetail(params)
          .then((res) => {
            this.pageLoading = false
            if (res) {
              if (Number(res.code) === 1) {
                const obj = res.obj
                this.productDetails = obj
              } else {
                this.$confirm(res.code, {
                  confirmButtonText: '确定',
                  showCancelButton: false
                })
              }
            }
          })
          .catch(() => {})
      } else if (this.refundInfo.subOrderType === '2') {
        this.agreeAccessoryDialog = true
      }
      this.checkStatus = '1'
    },

    refusedRefund () {
      this.checkStatus = '2'
      this.refusedRefundDialog = true
      this.operationAmount = this.tableData
    },

    handleSelectionChange (val) {
      this.selectIdList = []
      this.selectionList = val
      if (this.selectionList.every(e => e.refundStatus === '1')) {
        this.isAgree = false
        this.isRefuse = false
      } else {
        this.isAgree = true
        this.isRefuse = true
      }
      this.selectionList.forEach(e => {
        this.selectIdList.push(e.id)
      })
    },

    actualRefundAmountChange (e) {
      if (e.actualRefundAmountDialog > e.applyRefundAmount) {
        e.actualRefundAmountDialog = e.applyRefundAmount
      }
    },

    actualRefundAmountBlur (e) {
      e.actualRefundAmountDialog = Number(e.actualRefundAmountDialog).toFixed(2)
    },

    onSubmit () {
      this.auditRecordVoList = {}
      this.itemVoList = []
      if (this.checkStatus === '1') {
        this.operationAmount.forEach((e) => {
          this.itemVoList.push({
            actualRefundAmount: e.actualRefundAmountDialog,
            id: e.id
          })
        })
        this.auditRecordVoList.operationId = this.userId
        this.auditRecordVoList.operationName = this.userName
        if (this.refundInfo.subOrderType === '2') {
          this.auditRecordVoList.remark = this.deliveryForm.remark
        } else if (this.refundInfo.subOrderType === '1') {
          this.auditRecordVoList.remark = this.operationAmount[0].remark
        }
        const params = {
          itemVoList: this.itemVoList,
          auditRecordVo: this.auditRecordVoList,
          orderId: this.id.id,
          results: '1'
        }
        // 附件同意
        if (this.refundInfo.subOrderType === '2') {
          this.$refs.deliveryForm.validate((valid) => {
            if (valid) {
              const amountArr = []
              this.operationAmount.forEach(item => {
                amountArr.push(item.actualRefundAmountDialog)
              })
              if (!amountArr.some(function (val) {
                return val !== undefined
              })) {
                this.$alert('请填写实际退款金额')
                return false
              }
              this.pageLoading = true
              approvalRefund(params).then((res) => {
                if (res) {
                  this.pageLoading = false
                  if (Number(res.code) === 1) {
                    this.$confirm('提交成功', {
                      confirmButtonText: '确定',
                      showCancelButton: false
                    })
                  } else {
                    if (res.code === 'ORDER_ORDER_0014') {
                      this.$alert('商品已发货，审核失败！', {
                        showClose: false,
                        center: true
                      })
                    } else {
                      this.$confirm(this.$t(res.code), {
                        confirmButtonText: '确定',
                        showCancelButton: false
                      })
                    }
                  }
                }
                this.refusedRefundDialog = false
                this.agreeServeDialog = false
                this.agreeAccessoryDialog = false
                this.agreeAccessoryDialog = false
                this.fetchList()
              })
            }
          })
        // 服务包同意
        } else if (this.refundInfo.subOrderType === '1') {
          if (!params.auditRecordVo.remark) {
            this.remarkInfo = true
            this.$confirm('请填写备注', {
              confirmButtonText: '确定',
              showCancelButton: false
            })
          } else {
            this.remarkInfo = false
          }
          if (!params.itemVoList[0].actualRefundAmount) {
            this.actualRefundAmountInfo = true
            this.$confirm('请填写实际付款金额', {
              confirmButtonText: '确定',
              showCancelButton: false
            })
          } else {
            this.actualRefundAmountInfo = false
          }
          if (
            this.actualRefundAmountInfo === false &&
          this.remarkInfo === false
          ) {
            this.pageLoading = true
            approvalRefund(params).then((res) => {
              if (res) {
                this.pageLoading = false
                if (Number(res.code) === 1) {
                  this.$confirm('提交成功', {
                    confirmButtonText: '确定',
                    showCancelButton: false
                  })
                } else {
                  this.$confirm(res.code, {
                    confirmButtonText: '确定',
                    showCancelButton: false
                  })
                }
              }
              this.agreeServeDialog = false
              this.agreeAccessoryDialog = false
              this.agreeAccessoryDialog = false
              this.fetchList()
            })
          }
        }
      } else {
        this.auditRecordVoList.operationId = this.userId
        this.auditRecordVoList.operationName = this.userName
        this.auditRecordVoList.remark = this.rejectForm.rejectRemark
        const params = {
          auditRecordVo: this.auditRecordVoList,
          orderId: this.id.id,
          results: '2'
        }
        this.$refs.rejectForm.validate((valid) => {
          if (valid) {
            this.pageLoading = true
            approvalRefund(params).then((res) => {
              this.pageLoading = false
              if (res) {
                if (Number(res.code) === 1) {
                  this.$confirm('提交成功', {
                    confirmButtonText: '确定',
                    showCancelButton: false
                  })
                } else {
                  this.$confirm(res.code, {
                    confirmButtonText: '确定',
                    showCancelButton: false
                  })
                }
              }
              this.refusedRefundDialog = false
              this.agreeServeDialog = false
              this.agreeAccessoryDialog = false
              this.agreeAccessoryDialog = false
              this.fetchList()
            })
          }
        })
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.footer {
  width: 100%;
  margin: 0;
}
.detail-section {
  h2 {
    margin: 15px 0;
    font-weight: bold;
  }
}
/deep/ .el-form-item {
  margin-bottom: 0;
}
/deep/ .el-form-item__label {
  text-align: right;
}
.dialog-footer {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
/deep/ .el-textarea {
  padding: 0 10px 10px 10px;
  width: 95%;
}
/deep/ .el-dialog__body {
  padding: 0 20px 10px;
}
/deep/ .el-form-item__label {
  color: #606266;
}
.demo-ruleForm {
  margin-top: 10px;
}
</style>
